import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HeroService } from '../../../../services/hero.service';
import { StorageService } from '../../../../services/storage.service';
import { NzModalService } from 'ng-zorro-antd';

@Component({
  selector: 'app-signinfo',
  templateUrl: './signinfo.component.html',
  styleUrls: ['./signinfo.component.scss']
})
export class SigninfoComponent implements OnInit {

  public printer:Array<any>=[''];
  public userinfo:Array<any>=[''];
  public merchant:Array<any>=[''];
  public acount:Array<any>=[''];
  public bean:Array<any>=[''];
  public province:Array<any>=[''];
  public city:Array<any>=[''];
  public district:Array<any>=[''];
  constructor(private heroService: HeroService,
              private route: ActivatedRoute,
              private modalService: NzModalService,
              private storageService: StorageService) { }

  ngOnInit() {
    const id = this.route.snapshot.paramMap.get('id');
    let url=host+"/main/merchantCompact/view?id="+id;
    this.heroService.get(url).then(result=>{
        if(result.code==0){
          this.printer[0]=result.data.printer;
          this.userinfo[0]=result.data.connectUser;
          this.merchant[0]=result.data.merchant;
          this.acount[0]=result.data.acount;
          this.bean[0]=result.data.bean;
          this.province[0]=result.data.province;
          this.city[0]=result.data.city;
          this.district[0]=result.data.district;
        }else{
          this.modalService.error({
            nzTitle: '提示',
            nzContent: result.msg
          });
        }
    })
  }
  //导出Excel
  exportOut(){
    const id = this.route.snapshot.paramMap.get('id');
    const token = this.storageService.getItem("token");
    window.location.href=host+"/main/merchantCompact/infoExport?id="+id+"&token="+token;
  }
}
